package com.zlm.DateJDK8;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author 13026
 */
public class DateTimeFormatterDemo {
    /*
     * 用于时间的格式化和解析
     * static DateTimeFormatter ofPattern(格式) 获取格式对象
     * String format(时间对象)                  按照指定方式格式化
     * */
    public static void main(String[] args) {
        ZonedDateTime zdt = Instant.now().atZone(ZoneId.systemDefault());
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss EE a");
        String s = dtf.format(zdt);
        System.out.println(s);
    }
}
